﻿<!DOCTYPE html>
<html lang="en">
<#include "../include/resource-head.ftl"/>
<body>
<#assign active='articleList'/>
<#include "../include/common-top.ftl"/>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
    <#include "../include/common-menu.ftl"/>
        <div class="main-content">
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="form-search">
                            <form class="form-inline clearfix">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        <i class="icon-calendar bigger-110"></i>
                                    </span>
                                    <input name="starttime" class="form-control date-picker col-xs-4" type="text"
                                           value="${starttime!}" data-date-format="yyyy-mm-dd">
                                    <span class="input-group-addon">至</span>
                                    <input name="endtime" class="form-control date-picker col-xs-4" type="text"
                                           value="${endtime!}" data-date-format="yyyy-mm-dd">
                                </div>
                            <@search labels=["手机号码","编号"] names=["phone","id"] isEnd=false></@search>
                            <@searchSelect label="状态" name="status" valueMap={"wait":"待处理","yes":"已完成","no":"已终止"} isEnd=true></@searchSelect>
                            </form>
                        </div>
                        <div class="table-responsive">
                            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                <@tableHead names=["申请时间","申请编号","手机号码","贷款金额(万)","贷款期限(月)","贷款类型","审核状态","操作时间","操作人","操作"]></@tableHead>
                                </tr>
                                </thead>
                                <tbody>
                                <#list pageInfo.list as item>
                                <tr>
                                    <@tableBody model=item propMap={"addtime":"yyyy-MM-dd","id":"","phone":"","account":"#0","term":"","productname":""}></@tableBody>
                                    <td>${item.status!?switch("wait","待处理","yes","已完成","no","已终止")}</td>
                                    <@tableBody model=item propMap={"verifydate":"yyyy-MM-dd","verifyuserName":""}></@tableBody>
                                    <td>
                                        <div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
                                            <#if item.status == "wait">
                                                <a class="btn btn-xs btn-success" onclick="verify('${item.id?string('#0')}')">
                                                    审核
                                                </a>
                                            <#else>
                                                <a class="btn btn-xs btn-danger"
                                                   onclick="alert('${item.verifycontent!}')">
                                                    查看
                                                </a>
                                            </#if>
                                        </div>
                                    </td>
                                </tr>
                                </#list>
                                </tbody>
                            </table>
                        <#include "../include/table-page.ftl"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<#include "../include/resource-script.ftl"/>

<div class="modal fade" tabindex="-1" role="dialog" id="verify">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">处理订单</h4>
            </div>

            <div class="modal-body">
                <form action="/admin/order/verify" method="post" class="form-horizontal" id="verifyForm">
                    <input type="hidden" name="id" id="id">
                <@formAddRadio label="审核状态" name="status" valueMap={"yes":"已完成","no":"已终结"}></@formAddRadio>
                    <div class="form-group">
                        <label class="control-label col-sm-2">审核意见:</label>
                        <div class=" col-sm-8">
                            <textarea name="verifycontent" id="content" class="form-control" required></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" id="btn" class="btn btn-primary">提交</button>
            </div>

        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<script>
    $('.date-picker').datetimepicker({autoclose: true, language: 'zh-CN', minView: 2});

    function verify(id) {
        $("#id").val(id);
        $("#verify").modal("show");
    }

    $("#btn").click(function () {
        var content = $("#content").val();
        if (content.length === 0) {
            alert("请输入审核意见");
            return;
        }
        $("#verifyForm").submit();
    });
</script>

</html>

